#Game: Vice City Stories
#Author: ~h~danssmnt~w~
#Version: v1.0
#Category: Map
#Date: 2025-11-29
#Description: A very simplistic blip sprite explorer and spawner.

// VARIABLES ///////////////////////////////////////////////////

// Sprite ID
0004: $_4000 = 0

// $_4001 -> Spawned Blip

// $_4002 $_4003 $_4004 -> XYZ Player Coordinates

// End Script Event
0004: $_4005 = 0

// Button Hold Timer
0004: $_4006 = 0

// VARIABLES ///////////////////////////////////////////////////

03D3: print_help_always_allow 'Blip Sprite Explorer v1.0 by ~h~danssmnt~w~~n~~n~Press ~h~ ~k~ ~AMLEF~ ~w~ or ~h~ ~k~ ~AMRIG~ ~w~ to change sprite ID.~n~Press ~h~ ~k~ ~VEEE~ ~w~ to spawn sprite.~n~Press ~h~ ~k~ ~TGSUB~ ~w~ to exit explorer.'

0002: goto @MAINLOOP

:INC_SPRITE_ID
// Sprite ID max. = 54 (from here all sprites are a white blob which crashes the game)
000F:   $_4000 > 53
0021: goto_if_true @HOLDING_BUTTON_LOOP

0007: $_4000 += 1
0002: goto @HOLDING_BUTTON_LOOP

:DEC_SPRITE_ID
// Sprite ID min. = 0
000F:   $_4000 > 0
0022: goto_if_false @HOLDING_BUTTON_LOOP

0009: $_4000 -= 1
0002: goto @HOLDING_BUTTON_LOOP

// If player is still pressing the button, loop until he stops
:HOLDING_BUTTON_LOOP
0001: wait 0

037A: args 0 out 0 locals_base_index 0 call_func @UI_MANAGER

0007: $_4006 += 1

// Player has pressed for 5 loops, end holding
000F:   $_4006 > 5
0021: goto_if_true @HOLDING_BUTTON_END

007F:   is_button_pressed 0 button 11
0021: goto_if_true @HOLDING_BUTTON_LOOP

007F:   is_button_pressed 0 button 10
0021: goto_if_true @HOLDING_BUTTON_LOOP

:HOLDING_BUTTON_END
0004: $_4006 = 0
0026: return

:SPAWN_SPRITE
// Remove Old Sprite
00BB: remove_blip $_4001

0043: get_char_coordinates $PLAYER_CHAR store_to $_4002 $_4003 $_4004
00C6: add_sprite_blip_for_coord $_4002 $_4003 $_4004 sprite $_4000 store_to $_4001
00BF: change_blip_scale $_4001 to 3
0026: return

// UI Loop
:UI_MANAGER
011E: print_with_number 'Sprite ID: ~1~' number $_4000 time 1 flag 0
0026: return

// Controls Loop
:CONTROLS_MANAGER
007F:   is_button_pressed 0 button 11
0021: goto_if_true @INC_SPRITE_ID

007F:   is_button_pressed 0 button 10
0021: goto_if_true @DEC_SPRITE_ID

007F:   is_button_pressed 0 button 15
0021: goto_if_true @SPAWN_SPRITE

007F:   is_button_pressed 0 button 8
0021: goto_if_true @CALL_EVENT_END_SCRIPT
0026: return

// Main Script Loop
:MAINLOOP
0001: wait 0
037A: args 0 out 0 locals_base_index 0 call_func @UI_MANAGER
037A: args 0 out 0 locals_base_index 0 call_func @CONTROLS_MANAGER

001B:   $_4005 == 1
0021: goto_if_true @END_SCRIPT

0002: goto @MAINLOOP


:CALL_EVENT_END_SCRIPT
0007: $_4005 += 1
0026: return

// Cleanup and terminate script
:END_SCRIPT
00BB: remove_blip $_4001
0004: $_4000 = 0
0004: $_4002 = 0
0004: $_4003 = 0
0004: $_4004 = 0
0004: $_4005 = 0
0004: $_4006 = 0
03D3: print_help_always_allow 'Exiting Blip Sprite Explorer...'
0023: terminate_this_script